import request from '@/utils/request'

/**
 * 获取权限点列表
 * @returns
 */
export const getPermissionListApi = () => {
  return request({
    url: '/sys/permission'
  })
}

/**
 * 添加角色
 * @param {*} data 添加角色所需数据
 * @returns
 */
export const addPermissionApi = data => {
  return request({
    url: '/sys/permission',
    method: 'post',
    data
  })
}

/**
 * 删除权限
 * @param {*} id 权限id
 * @returns
 */
export const delPermissionApi = id => {
  return request({
    url: `/sys/permission/${id}`,
    method: 'delete'
  })
}

/**
 * 获取权限点详情
 * @param {*} id 权限id
 * @returns
 */
export const getPermissionDetailApi = id => {
  return request({
    url: `/sys/permission/${id}`
  })
}

/**
 * 修改权限
 * @param {*} form 修改权限需要的参数
 * @returns
 */
export const editPermissionDetailApi = form => {
  return request({
    url: `/sys/permission/${form.id}`,
    method: 'put',
    data: form
  })
}
